Skip to content

fix(agc): skip registration-time preparation for unsupported shader types - #1893

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
fisherjoey:fix/agc-registered-shader-type-8
Oct 10, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
fisherjoey:fix/agc-registered-shader-type-8

Conversation

@fisherjoey

Copy link
Copy Markdown
Contributor

Closes #1892

What

PrepareRegistered throws AGC driver: unsupported registered shader type for any Shader::type outside 0, 1, 2, 4, 5, 6 and 7. Since #639 it runs for every RegisterShader, so one unknown type ends the run. Stray (PPSA02100, Unreal Engine 4) registers 13 shaders of type 8 at start-up. They have no SPI_SHADER_PGM_* registers and are never used by a draw or dispatch.

With this change:

  • At registration, an unsupported type is logged (Shader 0x… has unsupported registered shader type N; it is not prepared at registration) and no artifact is prepared.
  • Outside registration it still throws, now as AGC driver: unsupported registered shader type N.

Tested

Linux (Nobara 44, GCC), RTX 5070 Ti, NVIDIA 595.91.07.

New check UnsupportedTypeRegistration() in tests/execution/PreparedShaders.cpp. It registers a type 8 header with Stray's sh register table twice, and runs in every agc_driver_prepared_shaders mode.

ctest -R agc_driver_prepared_shaders
main 1be6f9f + the test only 4 of 5 fail (agc_driver_prepared_shaders, _indirect, _uncached, _debug) with AGC driver: unsupported registered shader type. _debug_failure passes, as it expects a failure.
this branch 5/5 pass

Stray on main + #861 + #1836: without this change it aborts at start-up with the error above. With it, all 13 type 8 registrations are skipped and the title reaches its window. It then stops on a separate, unrelated error.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw
  • No notes, investigation .md files or images added to the repository
  • Generic behaviour, not specific to one title
  • Depends on: none (related: fix(agc): defer shaders that cannot be prepared at registration to their first use #1836 defers shaders that fail to prepare; this type throws before that path)
  • AI-assisted: yes

@EdouardSence

Copy link
Copy Markdown
Contributor

Another title that needs this: Rise of the Ronin (PPSA04540).

Setup: Linux, RX 9070 XT (RADV). Base is main 43972e6 + #1836 + #1837 + #2105 + #2153, plus local throwing placeholders for imports the title never calls in these runs.

  • Without this PR, the title stops about 3 min 40 s in, while it loads its shaders: AGC driver: unsupported registered shader type.
  • With it, the log shows Shader ... has unsupported registered shader type 8; it is not prepared at registration for its type 8 shaders. The title goes on to a later, unrelated stop at about 4 min 40 s (NGS2: system option flags are not implemented).

Tested and written by Claude (AI assistant) on a contributor's machine.

@popcoder565

Copy link
Copy Markdown
Contributor

Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 21612855, merged onto main d70b899 in one build with 33 other AGC/shader PRs that had no Windows run.

  • This PR's tests pass: agc_driver_prepared_shaders, agc_driver_prepared_shaders_indirect, agc_driver_prepared_shaders_uncached, agc_driver_prepared_shaders_debug, agc_driver_prepared_shaders_debug_failure. None of them reported skipping a case.
  • Full ctest in that build: 514 of 515. The one failure is fix(agc): defer a shader whose code does not decode instead of aborting the title #2257's new test, which is registered without the Windows PATH setup.

No title was run.

🤖 Addressed by Claude Code

@SleglJan

Copy link
Copy Markdown
Contributor

A third title, with a different type: 007 First Light (PPSA11386 v01.018.000) on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1), RTX 3080 (NVIDIA 615.71.09). Base is main 58706dc (carried in by #2500's branch) plus the PRs that get the title this far: SleglJan#15 to #21, #1964, #2282, #2327, #2347, #2471, #2480, #2500 (the last three closed by the intake pause) and #1184's ResourceTracker.cpp change.

  • Without this PR, start-up stops after 654 shader-cache writes with AGC driver: unsupported registered shader type. With it (2161285), 10 of the 581 registered shaders are logged as Shader 0x… has unsupported registered shader type 3; it is not prepared at registration, and start-up goes on to at least 725 shader-cache writes and an unrelated recompiler stop (GetSamplerResource dword 3 is not a valid runtime value; chain: BitReverse32(Immediate)).
  • Unlike the type 8 shaders in the description, these type 3 headers carry program registers. APS5_TRACE_SHADER_REGS=all lists sh registers 0x148/0x149, 0x10a/0x10b and 0x100 (twice), plus context registers 0x286, 0x287, 0x2d6 and 0x2db; 0x148/0x149 and 0x10b are what PrepareRegistered reads for type 5. So for type 3 the skip may only defer a failure to the first use of these shaders. Neither run gets far enough to show what happens then.

AI-assisted: yes (Claude Code)

oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
@oneandonlydean
oneandonlydean merged commit c2ebc71 into boykopovar:main Oct 10, 2026
6 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…-shader-type-8

fix(agc): skip registration-time preparation for unsupported shader types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Registering a shader of type 8 aborts the title: "AGC driver: unsupported registered shader type"

5 participants